<template>
    <div class="process-monitoring-box">
        <commpVxeTable
         :config="dataTableConfig" 
         :columns="columnsVxe" 
         :formItem="formItem"
         ref="acceptanceRegistrationRef"
         >
            <template v-slot:fsxmc_name="{row}" data-desc="自定操作栏">
                <span v-if="row.fzwxtbzzt == '补正中'" class="fsxmcQ-c-t">[{{ row.fzwxtbzzt}}]</span>
                <span v-if="row.fzwxtbzzt == '已补正'" class="fsxmcQ-l-t">[{{ row.fzwxtbzzt}}]</span>

                <span v-if="row.fzwxtzgzt == '整改中'" class="fsxmcQ-c-t">[{{ row.fzwxtzgzt }}]</span>
                <span v-if="row.fzwxtzgzt == '已整改'" class="fsxmcQ-l-t">[{{ row.fzwxtzgzt }}]</span>

                <span v-if="row.fzwxtcjzt == '撤件回复'" class="fsxmcQ-h-t" @click="cjhfClick()">[{{ row.fzwxtcjzt }}]</span>
                <span v-if="row.fzwxtcjzt == '撤件审核中'" class="fsxmcQ-c-t">[{{ row.fzwxtcjzt }}]</span>
                <span v-if="row.fzwxtcjzt == '已撤件'" class="fsxmcQ-l-t">[{{ row.fzwxtcjzt }}]</span>

                <span v-if="row.fzwxtthzt" class="fsxmcQ-h-t">{{ row.fzwxtthzt }}</span>
                <a href="#" @click="viewingMattersClick(row)">{{ row.fsxmc }}</a>
            </template>
        <template v-slot:name_fslsj="{row}" data-desc="自定操作栏">
            <span>{{ timeProcessing(row.fslsj) }}</span>
        </template>
        <template v-slot:name_bjz="{row}" data-desc="自定操作栏">
            <span v-if="row.bjzt == '办结'" class="fsxmcQ-l-t">{{ row.bjzt }}</span>
            <span v-if="row.bjzt == '撤件'" class="fsxmcQ-c-t">{{ row.bjzt }}</span>
            <span v-if="row.bjzt == '非中心事项'" class="fsxmcQ-h-t">{{ row.bjzt }}</span>
        </template>
        <template v-slot:name_fblzt="{row}" data-desc="自定操作栏">
            <span v-if="row.fblzt == '待办'" class="fsxmcQ-h-t">{{ row.fblzt }}</span>
            <span v-if="row.fblzt == '退回'" class="fsxmcQ-c-t">{{ row.fblzt }}</span>
            <span v-if="row.fblzt == '已办'" class="fsxmcQ-l-t">{{ row.fblzt }}</span>
        </template>
        <template v-slot:name_ffssj="{row}" data-desc="自定操作栏">
            <span>{{ row.ffssj }}</span>
        </template>
        </commpVxeTable>
        <increase ref="refModel" :addEditParameter="addEditParameter" />
    </div>
</template>
<script>
import assessCheckApi from './service/api'
import increase from './increase.vue'
import commpVxeTable from '@/components/commp-vxe-table/commp-vxe-table.vue'
import blobType from '@/common/blobType'
import moment from 'moment'
import {
    queryJobByJobIdServe,
    getSqsxBm,
} from './service/index'
export default {
    components:{
        commpVxeTable,
        increase
    },
    props:{

    },
    data(){
        return{
            addEditParameter:{},
            formItem:[
                {
                    label: '事项名称',
                    model: 'fsxmc',
                },{
                    label: '企业名称',
                    model: 'fqymc',
                },{
                    label: '申请单号',
                    model: 'fsqdbh',
                },{
                    label: '任务编号',
                    model: 'fslbh',
                },{
                    label: '待办人',
                    model: 'fdbr',
                },{
                    label: '环节名称',
                    model: 'fhjmc',
                    placeholder: '环节名称',
                    type:'Select',
                    dictionaryType:'查验流程环节名称'
                },{
                    label: '办结状态',
                    model: 'bjzt',
                },{
                    label: '待办状态',
                    model: 'fblzt',
                    placeholder: '待办状态',
                    type:'Select',
                    dictionaryType:'流程待办状态'
                }

            ],//
            columnsVxe:[
            { 
                type: 'checkbox', 
                width: 60 ,
                fixed: 'left'
            },{
                title: '事项名称', //列头显示文字
                field: 'fsxmc',
                slots: {
                    default: 'fsxmc_name',
                },
            },{
                title: '企业名称', //列头显示文字
                field: 'fqymc',
            },{
                title: '申请单号',
                field: 'fsqdbh',
            },{
                title: '任务编号',
                field: 'fslbh',
            },{
                title: '接收时间',
                field: 'fslsj',
                slots: {
                    // 使用插槽模板渲染
                    default: 'name_fslsj',
                },
            },{
                title: '剩余天数',
                field: 'syday',
                width:60,
            },{
                title: '环节名称',
                field: 'fhjmc',
            },{
                title: '使用工日',
                field: 'fsyts',
            },{
                title: '办结状态',
                field: 'bjzt',
                slots: {
                    // 使用插槽模板渲染
                    default: 'name_bjz',
                },
            },{
                title: '待办状态',
                field: 'fblzt',
                slots: {
                    // 使用插槽模板渲染
                    default: 'name_fblzt',
                },
            },{
                title: '待办人',
                field: 'fdbr',
            },{
                title: '发送人',
                field: 'ffsrmc',
            },{
                title: '发送时间',
                field: 'ffssj',
                slots: {
                    // 使用插槽模板渲染
                    default: 'name_ffssj',
                },
            }],
            dataTableConfig:{
                api: assessCheckApi.list,
                rowId: 'jobid',
                fywflcode:blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],
                paramet:{
                    // onlyCurrentUser:false,
                    // fblzt:'待办'
                }
            },
        }
    },
    watch:{

    },
    mounted(){
        
    },
    methods:{
        cjhfClick(){
            this.$route.push('/enterpriseWithdrawalApplication/index')
        },
        timeProcessing(val){
            if(val){
                val = val.slice(0,11)
            }
            return val
        },
        //编辑
        viewingMattersClick(val){
            queryJobByJobIdServe({jobid:val.jobid}).then(res=>{
                //console.log(res)
                if(res.code == 200){
                    let data = res.result.sqsx
                    getSqsxBm({sqsxid:data.id}).then(res2=>{
                        if(res2.code == 200){
                            this.addEditParameter = {
                                sqsxbm:res2.result,
                                dbridRequired:true,
                                isReadOnly:true,
                                fywflcode:blobType.fywflcodeArr[blobType.menuType.indexOf(this.$route.name.substring(this.$route.name.indexOf('__'),this.$route.name.indexOf('_a')+2))],
                                jobid:res.result.job.id,
                                fblzt:res.result.job.fblzt,
                                fthyj:res.result.job.fthyj,
                                sqsxid:data.id,
                                fsxmc:data.fsxmc,
                                fsqsj:data.fsqsj?moment(data.fsqsj).format('YYYY-MM-DD'):'',
                                fjclx:data.fjclx,
                                fslzt:String(data.fslzt),
                                fslsj:data.fslsj?moment(data.fslsj).format('YYYY-MM-DD'):'',
                                fslbh:data.fslbh,
                                fwcsx:data.fwcsx,
                                fjzrq:data.fjzrq,

                                fqyid:data.fqyid,//企业Id
                                fqymc:data.fqymc,
                                ftyshxydm:data.ftyshxydm,
                                fqyfddbrfzr:data.fqyfddbrfzr,
                                fqylxr:data.fqylxr,
                                fqylxrdh:data.fqylxrdh,
                                fqyzszcdz:data.fqyzszcdz,
                                fszdq:data.fszdq,
                                fxxdz:data.fxxdz,

                                fcpmc:data.fcpmc,//产品名称
                                fsqdbh:data.fsqdbh,
                                fspdwmc:data.fspdwmc,
                                fbldwmc:data.fbldwmc,
                                ffsr:data.ffsr,
                                ffssj:data.ffssj,
                                fblr:data.fblr,
                                dbrid:[],
                                opinion:'',//办理意见
                                smgflag:false,//是否发送短信
                                fsxjclx:data.fsxjclx,
                                ...res.result.qy,
                            }
                            this.$refs.refModel.visibleShow = true
                            this.$refs.refModel.spinning = true
                            this.$aSpinningKey = true
                            this.$refs.refModel.getData(this.addEditParameter)
                        }else{
                            this.$message.warning(res2.message)
                        }
                    })
                }else{
                    this.$message.warning(res.message)
                }
            })
            
            
        },
    }
}
</script>